import { defineConfig, presetUno, presetAttributify, presetIcons } from 'unocss'

export default defineConfig({
  presets: [
    presetUno(),
    presetAttributify(),
    presetIcons({
      scale: 1.2,
      warn: true
    })
  ],
  shortcuts: [
    // 常用的快捷类
    [
      'btn',
      'px-4 py-1 rounded inline-block bg-teal-600 text-white cursor-pointer hover:bg-teal-700 disabled:cursor-default disabled:bg-gray-600 disabled:opacity-50'
    ],
    ['btn-primary', 'btn bg-blue-500 hover:bg-blue-600'],
    ['btn-secondary', 'btn bg-gray-500 hover:bg-gray-600'],
    ['flex-center', 'flex items-center justify-center'],
    ['flex-between', 'flex items-center justify-between']
  ],
  rules: [
    // 自定义规则
    [/^m-(.+)$/, ([, d]) => ({ margin: `${d}px` })],
    [/^p-(.+)$/, ([, d]) => ({ padding: `${d}px` })]
  ],
  theme: {
    colors: {
      primary: '#409eff',
      success: '#67c23a',
      warning: '#e6a23c',
      danger: '#f56c6c',
      info: '#909399'
    }
  }
})
